package com.lagou.framework.common;

import java.io.IOException;

/**
 * @author srh
 * @date 2020/03/31
 **/
public abstract class HttpServlet implements Servlet {

    private static final String GET_METHOD = "GET";

    public abstract void doGet(Request request, Response response) throws IOException;

    public abstract void doPost(Request request, Response response);

    @Override
    public void init() {

    }

    @Override
    public void destory() {

    }

    @Override
    public void service(Request request, Response response) throws IOException {
        if (GET_METHOD.equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }
}
